"""用户数据模型"""
from pydantic import BaseModel, EmailStr
from typing import Optional
from datetime import datetime
from enum import Enum


class LearningStyle(str, Enum):
    """学习风格"""
    VISUAL_ANALYTICAL = "visual_analytical"
    AUDITORY_SEQUENTIAL = "auditory_sequential"
    KINESTHETIC_GLOBAL = "kinesthetic_global"
    READING_WRITING = "reading_writing"


class UserBase(BaseModel):
    """用户基础模型"""
    username: str
    email: EmailStr
    nickname: Optional[str] = None


class UserCreate(UserBase):
    """创建用户模型"""
    password: str


class UserUpdate(BaseModel):
    """更新用户模型"""
    nickname: Optional[str] = None
    learning_style: Optional[LearningStyle] = None


class UserProfile(BaseModel):
    """用户资料模型"""
    user_id: str
    username: str
    email: str
    nickname: Optional[str] = None
    learning_style: Optional[LearningStyle] = None
    created_at: datetime
    last_login: Optional[datetime] = None


class UserStats(BaseModel):
    """用户统计信息"""
    user_id: str
    total_study_days: int
    total_study_hours: float
    total_questions: int
    current_streak: int
    longest_streak: int
    average_accuracy: float

